import React from 'react'
import { useDispatch ,useSelector }from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { NEWADD,VALUESTYPE } from '../Type/AddType.d';
import CityItem from '../Compoment/AddItem';


function NewAdd() {
    const Navigate = useNavigate();
    const Dispatch = useDispatch();

    const onFinish = (values:VALUESTYPE) => {
        console.log(values);
        values.id = new Date() as any *1 ;
        Dispatch({
            type:NEWADD,
            payload:values
        })
        Navigate('/Add')
    };
    return (
        <div className='NewAdd'>
            <CityItem onFinish={onFinish}></CityItem>
        </div>
    )
}

export default NewAdd